<%--
  Created by IntelliJ IDEA.
  User: 13095
  Date: 2024/9/18
  Time: 12:16
  To change this template use File | Settings | File Templates.
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html; charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<c:set value="${pageContext.request.contextPath}" var="path"></c:set>
<script src="${path}/static/js/jquery-3.2.1.min.js"></script>
<link rel="stylesheet" href="${path}/static/css/style.css">
<script src="${path}/static/js/script.js"></script>
<html>
<body>
<div class="container">
    <header>
        <h1>任务管理</h1>
        <jsp:include page="inc/inc.jsp"></jsp:include>
    </header>
    <main>
        <table>
            <tr>
                <th>订单编号</th>
                <th>描述</th>
                <th>送货员</th>
                <th>用户</th>
                <th>状态</th>
                <th>创建时间</th>
                <th>接受时间</th>
                <th>操作</th>
            </tr>
           <c:forEach items="${requestScope.ordersPageInfo.list}" var="orders">
               <tr>
                   <td>${orders.orderNumber}</td>
                   <td>${orders.task.description}</td>
                   <td>${orders.runner.runnerName}</td>
                   <td>${orders.users.username}</td>
                   <td><c:if test="${orders.status==0}">未接单</c:if>
                   <c:if test="${orders.status==1}">
                       正在取货</c:if>
                   <c:if test="${orders.status==2}">正在配送</c:if>
                   <c:if test="${orders.status==3}">
                       待评价
                   </c:if>
                   <c:if test="${orders.status==4}">
                       已评价
                   </c:if>
                   <c:if test="${orders.status==-1}">
                       已取消
                   </c:if> </td>
                   <td><fmt:formatDate value="${orders.createdAt}" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate> </td>
                   <td><fmt:formatDate value="${orders.acceptTime}" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate></td>
                   <td> <a href=${path}/manage/deleteOrder?id=${orders.id}">删除</a>

<%--                   <c:if test="${orders.status==0}"><a href="/manage/runnerPoint?id=${orders.id}">分配跑腿员</a> </c:if> </td></tr>--%>
           </c:forEach>
        </table>
        <div class="pagination" >
            <c:if test="${requestScope.ordersPageInfo.hasPreviousPage}">
                <a href="${path}/manage/orderList?page=${requestScope.ordersPageInfo.pageNum - 1}" title="上一页">上一页</a>
            </c:if>
            <c:forEach begin="1" end="${requestScope.ordersPageInfo.pages}" var="pageNum">
                <c:choose>
                    <c:when test="${pageNum == requestScope.ordersPageInfo.pageNum}">
                        <span class="current-page" title="当前页：${pageNum}">${pageNum}</span>
                    </c:when>
                    <c:otherwise>
                        <a href="${path}/manage/orderList?page=${pageNum}" title="跳转到第 ${pageNum} 页">${pageNum}</a>
                    </c:otherwise>
                </c:choose>
            </c:forEach>
            <c:if test="${requestScope.ordersPageInfo.hasNextPage}">
                <a href="${path}/manage/orderList?page=${requestScope.ordersPageInfo.pageNum + 1}" title="下一页">下一页</a>
            </c:if>
        </div>
    </main>
</div>
</body>
</html>
